package com.example.c6chapterliu;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class RegisterServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
        response.setContentType("text/html");
        response.setCharacterEncoding("UTF-8");
        request.setCharacterEncoding("utf-8");
        String userName=request.getParameter("userName");
        String userPwd=request.getParameter("userPwd");
        String email=request.getParameter("email");
        String userSex=request.getParameter("userSex");
        String userEducation=request.getParameter("userEducation");
        PrintWriter out=response.getWriter();
        out.println("<HTML>");
        out.println("<HEAD><TITLE>用户注册结果 </TITLE></HEAD>");
        out.println("<BODY><br/>");
        out.println("<h3>用户注册结果</h3>");
        out.println("<table border=1 align=left>");
        out.println("<tr><td>userName</td><td>"+userName +"</td></tr> ");
        out.println("<tr><td>userPwd</td><td>"+userPwd +"</td></tr> ");
        out.println("<tr><td>email</td><td>"+email +"</td></tr> ");
        out.println("<tr><td>userSex</td><td>"+ userSex +"</td></tr> ");
        out.println("<tr><td>userEducation</td><td>"+ userEducation +"</td></tr> ");
        out.println("</table></BODY>");
        out.println("<HTML>");
        out.flush();
        out.close();
    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
